import Vue from 'vue'
import VueRouter from 'vue-router'

Vue.use(VueRouter)

const routes = [
    // ===========登录页面==========
  { path: '/login', name: 'login', component: () => import('@/views/login/login.vue')},
  // ===========注册页面==========
  { path: '/register', name: 'register', component: () => import('@/views/login/register.vue')},
  // ===========忘记密码页面==========
  { path: '/forgetPassword', name: 'forgetPassword', component: () => import('@/views/login/forgetPassword.vue')},

    //===============管理员主页===============
  {
    path: '/admin', name: 'adminLayout', component:() => import('@/views/admin/adminLayout.vue'),
    redirect: '/admin/home',
    children: [           // 子路由
        //===========首页面================
      { path: 'home', name: 'home', component:() => import('@/views/admin/home/home.vue')}
    ]
  },

  //     =======用户主页========
  {
    path: '/user/',
    name: 'layoutUser',
    component: () => import('@/views/user/userLayout.vue'),
    redirect: '/user/home',
    children: [    // 子路由
      // =======首页面=========
      {path: 'home', name: 'home', component: () => import('@/views/user/home/home.vue')},

      // // =======查看记录========
      // {path: 'borrowRecord', name: 'borrowRecord', component: () => import('@/views/user/record/borrowRecord.vue')},
      // {path: 'remarkRecord', name: 'remarkRecord', component: () => import('@/views/user/record/remarkRecord.vue')},
      // {path: 'donateRecord', name: 'donateRecord', component: () => import('@/views/user/record/donateRecord.vue')},
      //
      // // ========图书排行榜=======
      // {path: 'rankingList', name: 'rankingList', component: () => import('@/views/user/rankingList/rankingList.vue')},
      //
      // // ========公告=======
      // {
      //   path: 'notification',
      //   name: 'notification',
      //   component: () => import('@/views/user/notification/notification.vue')
      // },
      //
      // // ========图书借阅=======
      // {path: 'borrow', name: 'borrow', component: () => import('@/views/user/borrow/borrow.vue')},
    ],
  },


]

const router = new VueRouter({
  mode: 'history',
  base: process.env.BASE_URL,
  routes
})

export default router
